<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>

	<body>
		<script type="text/javascript">
			function getArray(arr) {
				var arrs = [];
				console.log(arrs);
				for(var i = 0, l = arr.length; i < l; i++) {
					if(!Array.isArray(arr[i])) {
						console.log(arrs);
						arrs.push(arr[i]);
						console.log(arrs);
					} else {
						console.log(arrs);
						arrs = arrs.concat(getArray(arr[i]));
						console.log(arrs);
					}					
				}				
				return arrs;
			}
			var a = [2, 3, [4, 6, [1, 8]], 12, 10];
			var b = getArray(a);
			console.log(b);
		</script>
	</body>

</html>